@extends('desktop.template.bootstrap')
@section('title', $book->name.' - '.$book->author.' - 007书房')
@section('keywords', $book->name.','.$book->author.',007书房')
@section('description', $book->name.'最新章节及全集列表免费在线阅读，本小说作者：'.$book->author.'，由007书房会员整理上传。'.str_limit(str_replace("&nbsp;","",strip_tags($book->abstract)), 200))

@section('scripts')
<link rel="stylesheet" href="{{asset('css/public-book.css')}}" />
@endsection

@section('header')
@include('desktop.template.navbar-complete')
@endsection

@section('content')

<section class="banner" style="background-image: url('{{asset('images/book-banner.jpg')}}')">
	<div class="container">
		<ol class="breadcrumb inverse">
			<li><a href="{{ url('/') }}">首页</a></li>
			@if(!is_null($category))
			<li><a href="{{ url('/categories/'.$category->order) }}">{{ $category->name }}</a></li>
			@endif
			<li class="active"><a href="javascript:void(0)">{{ $book->name }}</a></li>
		</ol>
	</div>
</section>

<section class="title">
	<div class="container">
		<div class="book-title">
			<div class="media">
				<div class="media-left">
					<img class="book-thumbnail" src="{{ $book->thumbnailUrl() }}" alt="" />
				</div>
				<div class="media-body">
					<h2 class="title">{{ $book->name }}</h2>
					<div class="author">
						<span class="fa fa-fw fa-user-circle-o"></span>
						{{ $book->author }}
					</div>
					<p class="content">
						{!! $book->abstract !!}
					</p>
					<div class="ctrl-container">
						<div class="col-xs-12">
							<div class="col-xs-2">
								@if(Session::has($book->id))
								<a class="btn btn-default" href="{{ url('books/'.$book->id.'/sections/'.Session::get($book->id)) }}">
									<span class="fa fa-book"></span>
									继续阅读
								@elseif($book->getFirstSection())
								<a class="btn btn-default" href="{{ url('books/'.$book->id.'/sections/'.$book->getFirstSection()->order) }}">
									<span class="fa fa-book"></span>
									开始阅读
								@endif
								</a>
							</div>
							@if(Auth::check())
							<div class="col-xs-2">
									@if(Auth::user()->isInBookshelves($book->id))
									<button class="btn btn-default disabled">
										<span class="fa fa-plus"></span>
										已加书架
									</button>
									@else
									{!! Form::open(array('method' => 'POST', 'url' => 'cs/bookshelves', 'class' => 'form-inline')) !!}
									<input type="hidden" name="bookId" value="{{ $book->id }}">
									<button class="btn btn-default" type="submit">
										<span class="fa fa-plus"></span>
										加入书架
									</button>
									{!! Form::close() !!}
									@endif
							</div>
							@endif
							<div class="col-xs-2">
								<a href="#" class="btn btn-danger disabled">
									<span class="fa fa-arrow-down"></span>
									TXT下载
								</a>
							</div>
	<!-- 						<a href="#" class="btn btn-default">投推荐票</a> -->
						</div>
					</div>
					<div class="point">
						<i>{{ $book->likes }}&nbsp;&nbsp;<span class="fa fa-heart"></span></i>
					</div>
				</div>
			</div>
		</div>
	</div>
</section>
<section class="content">
	<div class="container">
		<div class="title">
			最新章节
		</div>
		<ul class="lists">
			@foreach($newSections as $newSection)
			<li><a href="{{ url('/books/'.$book->id.'/sections/'.$newSection->order) }}">{{ str_limit($newSection->name, 40) }}</a></li>
			@endforeach
		</ul>
	</div>
</section>
<section class="content">
	<div class="container">
		<div class="title">
			正文卷 · 共{{ $sections->total() }}章
		</div>
		<ul class="lists">
			@foreach($sections as $section)
			<li><a href="{{ url('/books/'.$book->id.'/sections/'.$section->order) }}">{{ str_limit($section->name, 40) }}</a></li>
			@endforeach
		</ul>
		<div class="text-center">
			{!! $sections->render() !!}
		</div>
	</div>
</section>

@endsection